<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <p>a:{{a}}</p>
        <p>doubleA:{{doubleA}}</p>
        <p>
            <button @click="addA">a++</button>
            <button @click="reduceA">a--</button>
        </p>
    </div>
</body>
<script type="module">
    // 整体载入  => 查看模块内暴露的变量和方法
    import * as Vue from "../js/vue.esm-browser.js"; 
    console.log(Vue);

    // 按需引入
    import {createApp} from  "../js/vue.esm-browser.js"; 


    // 选项式很多功能都依赖于this
    let app = createApp({
        data(){
            return {
                a:1,
            }
        },
        computed:{
            doubleA:function(){
                return this.a * 2
            }
        },
        methods: {
            addA(){
                this.a++;
            },
            reduceA(){
                this.a--;
            }
        },
        mounted(){
            console.log(this);
        }
    })

    app.mount("#app");
</script>
</html>